<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script text="text/javascript">
    /**
    * @param {string} num1
    * @param {string} num2
    * @return {string}
    */
    var multiply = function(num1, num2) {
        if(num1=='0'||num2=='0')
        {
            return '0';
        }
        var len1=num1.length,len2=num2.length;
        var store=new Array(num1.length+num2.length-1).fill(0);
        for(let i=0;i<len1;i++)
        {
            for(let j=0;j<len2;j++)
            {
                store[i+j]+=num1[i]*num2[j];
            }
        }
        var ans=num1.length+num2.length-1;
        let t=0;
        let r=0;
        while(ans--){
            r=(store[ans]+t)%10;
            t=(store[ans]+t)/10|0;
            store[ans]=r;
        }
        if(t!=0)
        store.splice(0,0,t);
        //用于把数组中的所有元素放入一个字符串。 
        return  store.join("");
        //  console.log(typeof store.join("")) // string
    };
    console.log(multiply('123','9'));
    </script>
</body>
</html>